//vuex
import Vue from "vue";
import Vuex from "vuex";

//该插件用来解决 vuex永久性存储问题
import persistedState from 'vuex-persistedstate';
Vue.use(Vuex);

export default new Vuex.Store({
    state:{
        token:'',
        num:0,
        list:[]//面包屑导航数据
    },
    mutations:{
        setToken(state,token){
            state.token = token;
        },
        setList(state,list){
            state.list = list;
        }
    },
    actions:{
        ActionToken({commit},token){
            commit('setToken',token);
        }
    },
    getters:{
        token:(state)=> state.token,
        list:(state)=>state.list,
    },
    modules:{},
    plugins:[persistedState()]//将vuex中所有的数据，进行永久化存储
})